from rest_framework import generics, serializers
from .models import Project,RequestsInfo,ScriptStep




class ProjectSerializer(serializers.ModelSerializer):
    #脚本数 在项目列表中会显示
    scriptcase_count = serializers.SerializerMethodField()
    class Meta:
        model = Project
        fields = '__all__'

    def get_scriptcase_count(self, obj):
        return obj.script_cases.count()


